package cn.edu.jxau.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.jxau.service.checkMessage;
import cn.edu.jxau.service.removeCheckMessage;

public class logoutServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		removeCheckMessage.RemoveMessage(request);
		
		checkMessage checkMessage=new checkMessage();
		// 根据地址栏的传值判断跳转方向
		if (request.getParameter("value").equals("1")) {
			
			checkMessage.updataState((String)request.getAttribute("username"), "离线");//修改用户状态
			request.getRequestDispatcher("blogServlet").forward(request, response);
		} else if (request.getParameter("value").equals("2")) {
			response.sendRedirect("topic.jsp");
		}

	}

}
